package com.xry.test1.controller;

import com.xry.test1.service.impl.SoilServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/water")
public class WaterController {

    @Autowired
    private SoilServiceImpl soilService;

    @PostMapping("/watering")
    public ResponseEntity<Object> watering() {
        boolean success = soilService.water_pump();
        return success ? ResponseEntity.ok("OK") : ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("ERROR");
    }
}
